import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    themeColor: localStorage.getItem("themeColor") || "#409EFF",
  },
  getters: {},
  mutations: {
    setThemeColor(state, payload) {
      state.themeColor = payload;
      localStorage.setItem("themeColor", payload);
    },
  },
  actions: {
    getThemeColor({ commit }, payload) {
      if (localStorage.getItem("themeColor")) return;
      setTimeout(() => {
        commit("setThemeColor", "#028e6b");
      }, 2000);
    },
  },
  modules: {},
});
